package com.liyunc.demo.comp.common.exceptions.enums;

/**
 * 枚举一些常用的Api操作码.
 */
public enum ErrorCode implements IErrorCode {
    /**
     * 服务器内部报错.
     */
    SERVER_ERROR(1000001, "server error"),
    /**
     * 未登录.
     */
    UNAUTHORIZED(1000002, "unauthorized"),
    /**
     * 权限不够.
     */
    FORBIDDEN(1000003, "forbidden"),
    /**
     * 用户名或密码错误.
     */
    USERNAME_OR_PASSWORD_ERROR(1000004, "username or password error"),
    /**
     * 无效的参数.
     */
    INVALID_ARGUMENT(1000005, "invalid argument"),
    /**
     * 数据查询错误.
     */
    DATA_NOT_EXIST_ERROR(1000006, "data not exist"),
    /**
     * 数据添加异常.
     */
    DATA_ADD_ERROR(1000007, "data add exception"),
    /**
     * 数据重复.
     */
    DATA_DUPLICATION(1000008, "data duplication"),
    /**
     * 文件上传异常.
     */
    FILE_UPLOAD_ERROR(1000009, "upload error");

    private final long code;
    private final String message;

    ErrorCode(long code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public Long getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
